/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dis.model;

import dis.servlet.ServletEstadoSistema;
import java.io.*;

/**
 *
 * @author Manuel Lap
 */
public class DatosConfiguracion {
    
    private String host;
    
    private String puerto;
    
    private String nameUser;
    
    private String nombreBd;
    
    private String pass;

    
    public void getDatosConfig() throws FileNotFoundException, IOException{
        readFileConfig();
    }
    
    private void readFileConfig() throws FileNotFoundException, IOException{
        File configFile = new File(ServletEstadoSistema.pathConfig + "/config.txt");
        FileReader configReader = new FileReader(configFile);
        BufferedReader configBuffered =  new BufferedReader(configReader);
        host = configBuffered.readLine();
        puerto = configBuffered.readLine();
        nameUser = configBuffered.readLine();
        nombreBd = configBuffered.readLine();
        pass =  configBuffered.readLine();
        if(pass == null) pass = "";
        configBuffered.close();
        configReader.close();
        /*host = "localhost";
        puerto = "3306";
        nameUser = "root";
        nombreBd = "ipostdistribuido";
        pass = "";*/
    }
    
    /**
     * @return the host
     */
    public String getHost() {
        return host;
    }

    /**
     * @param host the host to set
     */
    public void setHost(String host) {
        this.host = host;
    }

    /**
     * @return the puerto
     */
    public String getPuerto() {
        return puerto;
    }

    /**
     * @param puerto the puerto to set
     */
    public void setPuerto(String puerto) {
        this.puerto = puerto;
    }

    /**
     * @return the nombreBd
     */
    public String getNombreBd() {
        return nombreBd;
    }

    /**
     * @param nombreBd the nombreBd to set
     */
    public void setNombreBd(String nombreBd) {
        this.nombreBd = nombreBd;
    }

    /**
     * @return the pass
     */
    public String getPass() {
        return pass;
    }

    /**
     * @param pass the pass to set
     */
    public void setPass(String pass) {
        this.pass = pass;
    }

    /**
     * @return the nameUser
     */
    public String getNameUser() {
        return nameUser;
    }

    /**
     * @param nameUser the nameUser to set
     */
    public void setNameUser(String nameUser) {
        this.nameUser = nameUser;
    }
    
}
